<?php
/* SVN FILE: $Id: app_controller.php 6311 2008-01-02 06:33:52Z phpnut $ */
/**
 * Short description for file.
 *
 * This file is application-wide controller file. You can put all
 * application-wide controller-related methods here.
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
 * Copyright 2005-2008, Cake Software Foundation, Inc.
 *								1785 E. Sahara Avenue, Suite 490-204
 *								Las Vegas, Nevada 89104
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright		Copyright 2005-2008, Cake Software Foundation, Inc.
 * @link				http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
 * @package			cake
 * @subpackage		cake.app
 * @since			CakePHP(tm) v 0.2.9
 * @version			$Revision: 6311 $
 * @modifiedby		$LastChangedBy: phpnut $
 * @lastmodified	$Date: 2008-01-02 06:33:52 +0000 (Wed, 02 Jan 2008) $
 * @license			http://www.opensource.org/licenses/mit-license.php The MIT License
 */
/**
 * Short description for class.
 *
 * Add your application-wide methods in the class below, your controllers
 * will inherit them.
 *
 * @package		cake
 * @subpackage	cake.app
 */
class AppController extends Controller {

	var $components = array('Auth', 'AutoLogin', 'Settings', 'RequestHandler');
	var $helpers = array('Html', 'Form', 'Time', 'Number', 'Javascript', 'Ebocash', 'Ajax');
	var $uses = array('Setting', 'User');

	function beforeFilter() {

		if (isset($this->Auth)) {
			$this->Auth->deny('*');
			$this->Auth->autoRedirect = false;
			$this->Auth->loginRedirect = array('controller'=>'purchases', 'action'=>'qadd');
			$this->Auth->fields = array('username'=>'username','password' => 'password');
		}

	}

	function beforeRender() {
		if (isset($this->Auth)) {
			$this->set('User', $this->Auth->user());
		}

		if ($this->RequestHandler->isAjax()) {
			Configure::write('debug', 0);
		}

//		$this->set('Settings', $this->Setting->find('list', array('fields'=>array('key','value'))));
	}

}
?>
